Service class documentation

class nlp_architect.server.service.Service(service_name)[source]

Handles loading and inference using specific models

get_paragraphs()[source]
get_service_inference(docs, headers)[source]

get parser response from service API

Parameters
  • headers (list(str)) – the headers of the request

  • docs – input received from the request

Returns

the service API output

load_service(name)[source]

Initialize and load service from input given name, using “services.json” properties file

Parameters

name (str) – The name of service to upload using server

Returns

The loaded service

class nlp_architect.common.core_nlp_doc.CoreNLPDoc(doc_text: str = '', sentences: list = None)[source]

Object for core-components (POS, Dependency Relations, etc).

_doc_text

the doc text

_sentences

list of sentences, each word in a sentence is represented by a dictionary, structured as follows: {‘start’: (int), ‘len’: (int), ‘pos’: (str), ‘ner’: (str), ‘lemma’: (str), ‘gov’: (int), ‘rel’: (str)}

brat_doc()[source]

Returns doc adapted to BRAT expected input.

static decoder(obj)[source]
displacy_doc()[source]

Return doc adapted to displacyENT expected input.

property doc_text
json()[source]

Returns json representations of the object.

pretty_json()[source]

Returns pretty json representations of the object.

sent_iter()[source]
sent_text(i)[source]
property sentences
class nlp_architect.common.high_level_doc.HighLevelDoc[source]

object for annotation documents

Parameters
  • self.doc_text (str) – document text

  • self.annotation_set (list(str)) – list of all annotations in doc

  • self.spans (list(dict)) – list of span dict, each span_dict is structured as follows: { ‘end’: (int), ‘start’: (int), ‘type’: (str) string of annotation }

displacy_doc()[source]

Return doc adapted to displacyENT expected input

json()[source]

Return json representations of the object

Returns

json representations of the object

Return type

json

pretty_json()[source]

Return pretty json representations of the object

Returns

pretty json representations of the object

Return type

json